package com.seanLab.domain;

import com.seanLab.dto.SuggestArticleKeywordsDto;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by ailly on 17-10-6.
 */
@Document(collection = "#{getEditorSession}")
public class EditorSession implements Serializable {
    @Id
    private String sessionID;

    private Date recommendDate;
    private String title;
    private String content;
    private String url;
    private List<SuggestArticleKeywordsDto> keywords;
    private List<String> recommendedImgs;
    private List<RecommendedImg> recImgs;

    private List<Integer> adoptedImgSNs;
    private List<String> adoptedImgs;

    private long processTime;
    private int coverFlag = 0;
    private int acceptFlag = 0;
    private int acceptCount = 0;
    private int top1AcceptFlag = 0;
    private int top5AcceptFlag = 0;

    private int articleCategory;
    private int isTestFlag = 0;

    private String testLabel;

    class RecommendedImg {
        String imgID;
        List<String> tagID;
        List<String> tagName;
        double imgScore;
        String url;

        public double getImgScore() {
            return imgScore;
        }

        public void setImgScore(double imgScore) {
            this.imgScore = imgScore;
        }

        public String getImgID() {
            return imgID;
        }

        public void setImgID(String imgID) {
            this.imgID = imgID;
        }

        public List<String> getTagID() {
            return tagID;
        }

        public void setTagID(List<String> tagID) {
            this.tagID = tagID;
        }

        public List<String> getTagName() {
            return tagName;
        }

        public void setTagName(List<String> tagName) {
            this.tagName = tagName;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }
    }

    public EditorSession() {
    }

    public List<SuggestArticleKeywordsDto> getKeywords() {
        return keywords;
    }

    public void setKeywords(List<SuggestArticleKeywordsDto> keywords) {
        this.keywords = keywords;
    }

    public String getSessionID() {
        return sessionID;
    }

    public void setSessionID(String sessionID) {
        this.sessionID = sessionID;
    }

    public Date getRecommendDate() {
        return recommendDate;
    }

    public void setRecommendDate(Date recommendDate) {
        this.recommendDate = recommendDate;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public List<String> getRecommendedImgs() {
        return recommendedImgs;
    }

    public void setRecommendedImgs(List<String> recommendedImgs) {
        this.recommendedImgs = recommendedImgs;
    }

    public List<RecommendedImg> getRecImgs() {
        return recImgs;
    }

    public void setRecImgs(List<RecommendedImg> recImgs) {
        this.recImgs = recImgs;
    }

    public List<String> getInnerImgTagIDs(int imgIndex) {
        return this.recImgs.get(imgIndex).getTagID();
    }

//    public void addInnerImg(String imgID, List<String> tagIDs, List<String> tagNames) {
//        RecommendedImg rc = new RecommendedImg();
//        rc.setImgID(imgID);
//        rc.setTagID(tagIDs);
//        rc.setTagName(tagNames);
//        this.recImgs.add(rc);
//    }

    public void addInnerImg(String imgID, List<String> tagIDs, List<String> tagNames, double imgScore, String url)  {
        RecommendedImg rc = new RecommendedImg();
        rc.setImgID(imgID);
        rc.setTagID(tagIDs);
        rc.setTagName(tagNames);
        rc.setImgScore(imgScore);
        rc.setUrl(url);
        this.recImgs.add(rc);
    }

    public void initInnerImg(){
        List<RecommendedImg> rci = new ArrayList<>();
        this.recImgs = rci;
    }

    public int getAcceptCount() {
        return acceptCount;
    }

    public void setAcceptCount(int acceptCount) {
        this.acceptCount = acceptCount;
    }

    public long getProcessTime() {
        return processTime;
    }

    public void setProcessTime(long processTime) {
        this.processTime = processTime;
    }

    public int getCoverFlag() {
        return coverFlag;
    }

    public void setCoverFlag(int coverFlag) {
        this.coverFlag = coverFlag;
    }

    public int getAcceptFlag() {
        return acceptFlag;
    }

    public void setAcceptFlag(int acceptFlag) {
        this.acceptFlag = acceptFlag;
    }

    public int getTop1AcceptFlag() {
        return top1AcceptFlag;
    }

    public void setTop1AcceptFlag(int top1AcceptFlag) {
        this.top1AcceptFlag = top1AcceptFlag;
    }

    public int getTop5AcceptFlag() {
        return top5AcceptFlag;
    }

    public void setTop5AcceptFlag(int top5AcceptFlag) {
        this.top5AcceptFlag = top5AcceptFlag;
    }

    public List<Integer> getAdoptedImgSNs() {
        return adoptedImgSNs;
    }

    public void setAdoptedImgSNs(List<Integer> adoptedImgSNs) {
        this.adoptedImgSNs = adoptedImgSNs;
    }

    public List<String> getAdoptedImgs() {
        return adoptedImgs;
    }

    public void setAdoptedImgs(List<String> adoptedImgs) {
        this.adoptedImgs = adoptedImgs;
    }

    public int getArticleCategory() {
        return articleCategory;
    }

    public void setArticleCategory(int articleCategory) {
        this.articleCategory = articleCategory;
    }

    public int getIsTestFlag() {
        return isTestFlag;
    }

    public void setIsTestFlag(int isTestFlag) {
        this.isTestFlag = isTestFlag;
    }

    public String getTestLabel() {
        return testLabel;
    }

    public void setTestLabel(String testLabel) {
        this.testLabel = testLabel;
    }
}
